//============================================================================
// Copyright (C) 2010 Brett R. Jones
// All Rights Reserved
//
// You may redistribute and/or modify for non commercial and commercial uses
// provided this copyright notice remains in place and is not modified
//
// This code is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// brettjones1900@gmail.com
// http://www.p2panarchy.com
//============================================================================


package com.roguetreasure.destroytheworld;

class SoundMgr 
{
	//=== const ===//
	//private static final String LOG_TAG = "SoundMgr: ";
	
	//=== vars ===//
	private DestroyWorldActivity 	m_oActivity;
	private SoundInterface			m_oSndInterface = new SoundInterface(); // interface native code can call
	private SoundMusicMgr			m_oSndMusicMgr = new SoundMusicMgr();	// manager of music and background sound
	private SoundSfxMgr				m_oSndSfxMgr = new SoundSfxMgr();	// manager of short sound effects
	
	
    //=== constructors ===//  
    public SoundMgr(DestroyWorldActivity oActivity) 
    {
    	//Log.i(LOG_TAG, "SoundMgr: constructed");
        m_oActivity = oActivity;
    }
    //=== Startup ===//  
    public void Startup() 
    {
    	//Log.i(LOG_TAG, "SoundMgr: Startup");
    	m_oSndMusicMgr.Startup( m_oActivity );	// manager of music and background sound
    	m_oSndSfxMgr.Startup( m_oActivity );	// manager of music and background sound
        m_oSndInterface.Startup( m_oActivity );
    }
    //=== shutdown ===//  
    public void Shutdown() 
    {
    	//Log.i(LOG_TAG, "SoundMgr: Shutdown");
    	m_oSndMusicMgr.Shutdown();	// manager of music and background sound
    	m_oSndSfxMgr.Shutdown();	// manager of music and background sound
    }
    //========================================================================
    // music functions
    //========================================================================
	//! call to play music ( background sound )
	public void MusicPlay( String strSndFile ) 
    {
    	//Log.i(LOG_TAG, "MusicPlay " + strSndFile );
		m_oSndMusicMgr.MusicPlay( strSndFile );
    }
	//! call to pause music
	public void MusicPause( String strSndFile ) 
    {
    	//Log.i(LOG_TAG, "MusicPause " + strSndFile );
		m_oSndMusicMgr.MusicPause( strSndFile );
    }
	//! call to stop music
	public void MusicStop( String strSndFile ) 
    {
    	//Log.i(LOG_TAG, "MusicStop " + strSndFile );
		m_oSndMusicMgr.MusicStop( strSndFile );
    }
	//! call to set music volume
	public void MusicSetVolume( float f32Volume ) 
    {
		if( f32Volume >= 1.0f )
		{
			f32Volume = 0.99f;
		}
    	//Log.i(LOG_TAG, "MusicSetVolume " + f32Volume );
		m_oSndMusicMgr.MusicSetVolume( f32Volume ); 
    }
    //========================================================================
    // sound effect functions
    //========================================================================
	//! call to play sfx ( sound effect )
	public void SfxPlay( String strSndFile ) 
    {
    	//Log.i(LOG_TAG, "SfxPlay " + strSndFile );
		m_oSndSfxMgr.SfxPlay( strSndFile ); 
    }
	//! call to pause sfx 
	public void SfxPause( String strSndFile ) 
    {
    	//Log.i(LOG_TAG, "SfxPause " + strSndFile );
		m_oSndSfxMgr.SfxPause( strSndFile );
    }
	//! call to stop sfx
	public void SfxStop( String strSndFile ) 
    {
    	//Log.i(LOG_TAG, "SfxStop " + strSndFile );
		m_oSndSfxMgr.SfxStop( strSndFile );
    }
	//! call to set sfx volume 
	public void SfxSetVolume( float f32Volume ) 
    {
    	//Log.i(LOG_TAG, "SfxSetVolume " + f32Volume );
		m_oSndSfxMgr.SfxSetVolume( f32Volume );
	}
	//! call to play movie ( game cut scene )
	public void MoviePlay( String strSndFile ) 
    {
    	//Log.i(LOG_TAG, "MoviePlay " + strSndFile );
    }
};
